<template>
	<view>
		<u-navbar :is-back="false" title="工作台" :background="background"></u-navbar>

		<view class="content"  :style="{'min-height': ' calc(100vh - '+navbarHeight + 'px)'}">


			<view class="tip">您好,{{ userInfo.nickName }}</view>
			<view class="manage boxShadow">
				<view class="title">推广任务</view>
				<view class="item bg1" @click="goExpandTask">
					<view class="label">推广任务</view>
					<view class="btn">去查看</view>
				</view>
			</view>

			<view class="scanQr  boxShadow">
				<view class="title">核销管理</view>
				<view class="f-c-sb">
					<view class="scan boxShadow" @click="scanCode">
						<view class="f-c-c btn">
							<image :src="imagePath+'glxcx/扫码_icon.png'" mode=""></image>
							扫码核销
						</view>
					</view>
					<view class="records boxShadow f-c-c" @click="goRecord">
						<view>
							<image :src="imagePath+'glxcx/核销记录_icon.png'" mode=""></image>
							<view>
								核销记录
								<u-icon name="arrow-right" color="#333333" size="26"></u-icon>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	let systemInfo = uni.getSystemInfoSync();
	export default {
		data() {
			return {
				imagePath: this.$imagePath,
				background: {
					background: 'url(https://sj.shopec.com.cn/image-server/glxcx/-e-00背景.png) no-repeat',
					backgroundSize: 'cover'
				},
				shopStatus: false,
				customerStatus: false,
				userStatus: false,
				noticeList: [
					'今天待推广: 10条'
				],
				navbarHeight: systemInfo.statusBarHeight+48
			};
		},
		computed: {
			userInfo() {
				return this.$store.state.userInfo;
			},
			customBar() {
				return this.$store.state.customBar;
			}

		},
		onLoad() {

		},
		methods: {
			onShareAppMessage: function(res) {
				return {
					path: 'pages/login/login'
				}
			},
			//推广任务
			goExpandTask() {
				this.$navigateTo('/marketing/expand/expandTask', {})
			},
			//扫码核销
			scanCode() {
				var that = this
				// 只允许从相机扫码
				wx.scanCode({
					onlyFromCamera: true,
					success(res) {

						that.$navigateTo('/workbench/chargeOff/chargeOff', {
							orderNo: res.result
						})
					}
				})
			},
			//核销记录
			goRecord() {
				if (this.userInfo.accountType == 2 && this.userInfo.modulePermissions.indexOf('63') == -1) {
					this.userStatus = true
					this.$refs.uToast.show({
						title: '暂无操作权限',
						type: 'error'
					});
					return;
				}
				this.$navigateTo('/workbench/verificationRecords/verificationRecords', {})
			}
		}
	};
</script>

<style lang="less">
	.content {
		width: 100%;
		background: linear-gradient(0deg, #ffffff 90%, #e5f0ff 100%);
		overflow: hidden;
		.tip {
			margin: 20rpx 40rpx;
			color: #333333;
			font-size: 36rpx;
			font-weight: bold;

		}

		.scanQr {
			width: 659rpx;
			background: #ffffff;
			border-radius: 16rpx;
			padding: 30rpx;
			box-sizing: border-box;
			margin: 20rpx auto;

			.title {
				font-size: 26rpx;
				font-weight: bold;
				text-align: left;
				color: #333333;
				margin-bottom: 20rpx;
			}

			.scan {
				width: 405rpx;
				height: 170rpx;
				background-image: url(https://sj.shopec.com.cn/image-server/glxcx/-e-扫码核销-背景.png);
				background-size: cover;
				background-repeat: no-repeat;
				position: relative;
				box-shadow: 0px 0px 5px 2px rgba(88, 88, 88, 0.13);

				.btn {
					width: 200rpx;
					height: 72rpx;
					background: #ffffff;
					border-radius: 36rpx;
					position: absolute;
					top: 50%;
					right: 47rpx;
					transform: translate(0, -50%);
					font-size: 26rpx;
					font-weight: bold;
					color: #1a81fe;

					image {
						width: 26rpx;
						height: 24rpx;
						margin-right: 10rpx;
					}
				}
			}

			.records {
				width: 174rpx;
				height: 170rpx;
				background: #ffffff;
				border-radius: 8rpx;
				font-size: 26rpx;
				font-weight: bold;
				text-align: left;
				color: #333333;
				box-shadow: 0px 0px 5px 2px rgba(88, 88, 88, 0.13);

				image {
					width: 56rpx;
					height: 56rpx;
					display: block;
					margin: 20rpx auto;
				}
			}
		}

		.manage {
			width: 659rpx;
			background: #ffffff;
			border-radius: 16rpx;
			padding: 30rpx;
			box-sizing: border-box;
			margin: 20rpx auto;

			.title {
				font-size: 26rpx;
				font-weight: bold;
				text-align: left;
				color: #333333;
				margin-bottom: 20rpx;
			}

			.item {
				background-color: #fff;
				box-shadow: 0px 0px 5px 2px rgba(88, 88, 88, 0.13);

				&.bg1 {
					background-image: url(https://sj.shopec.com.cn/image-server/glxcx/-e-客户管理-背景.png);
					background-size: cover;
					background-repeat: no-repeat;

					.btn {
						background: linear-gradient(0deg, #ff666c 0%, #ffb97a 100%);
					}

					.label {
						color: #ff686c;
					}
				}

				width: 600rpx;
				height: 170rpx;
				font-size: 26rpx;
				font-weight: 700;
				color: #ffffff;
				position: relative;

				.label {
					display: inline-block;
					position: absolute;
					right: 40rpx;
					bottom: 102rpx;
					width: 180rpx;
					text-align: center;
				}

				.btn {
					text-align: center;
					width: 140rpx;
					height: 60rpx;
					border-radius: 30rpx;
					position: absolute;
					right: 60rpx;
					bottom: 28rpx;
					line-height: 60rpx;
				}
			}
		}
	}
</style>
